package com.sann.eduservice.client;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.sann.common.utils.R;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * fallback = VodClientImpl.class, 当这里定义的服务不可用，改为调用VodClientImpl 里面对应的方法
 */
@Component
@FeignClient(name = "service-vod", fallback = VodClientImpl.class)
public interface VodClient {

    @ApiOperation(value = "根据视频id删除阿里云视频")
    @DeleteMapping(value = "/eduvod/video/deleteAliVideo/{videoId}")
    @HystrixCommand
    R deleteAliVideo(@PathVariable(name = "videoId") String videoId);

    @ApiOperation(value = "批量删除阿里云视频")
    @DeleteMapping(value = "/eduvod/video/batchDeleteVideo")
    @HystrixCommand
    R batchDeleteVideo(@ApiParam(name = "videoIdList", value = "云端视频Id集合", required = true)
                       @RequestParam(name = "videoIdList") List<String> videoIdList);

}
